#!/usr/bin/python3
# -*- coding: utf-8 -*-

import pytest

from public.project_patch import ALLURE_JSON, PYTEST_HTML


def collect_case():
    """
    收集测试用例条数
    :return:
    """
    pytest.main(["--co", "testcases/test_qingcloud"])


def run_pytest():
    """
    运行测试用例
    :return:
    """
    # 单进程运行测试用例
    # pytest.main()
    pytest.main(['testcases/test_qingcloud', '-m=iaas_debug', '--env=qingcloud', f'--alluredir={ALLURE_JSON}', f'--html={PYTEST_HTML}'])
    # pytest.main(['testcases/test_qingcloud', f'--alluredir={ALLURE_JSON}', f'--html={PYTEST_HTML}'])
    # pytest.main(
    #     [
    #         "testcases/test_qingcloud/test_vxnet.py",
    #         f"--alluredir={ALLURE_JSON}",
    #         f"--html={PYTEST_HTML}",
    #     ]
    # )

    # 多进程运行
    # pytest.main(['-n=auto', '--dist=loadfile'])

    # 多线程运行
    # pytest.main(['-m=test_demo2', '--tests-per-worker=2'])


if __name__ == "__main__":
    # collect_case()
    run_pytest()
